package com.study.jmm;

import java.util.ArrayList;
import java.util.List;

public class VolatileDemo2 {
    static volatile Integer times = 1;

    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        new Thread(() -> {
            list.add(times);
        }).start();
        new Thread(() -> {
            times = 100;
        }).start();
        System.out.println(list);
    }
}
